import { ApiProperty } from '@nestjs/swagger';

export class BaseVo {
  @ApiProperty({ title: '返回业务码', required: false, type: Number })
  code: number;

  @ApiProperty({ title: '返回信息', required: false, type: String })
  message: string;

  @ApiProperty({ title: '是否成功', required: false, type: Boolean })
  success: boolean;
}

export class Pagination<T> {
  @ApiProperty({ title: '当前页码', required: false, type: Number })
  current?: number;

  @ApiProperty({ title: '每页数量', required: false, type: Number })
  pageSize?: number;

  @ApiProperty({ title: '记录总量', required: false, type: Number })
  total: number;

  @ApiProperty({ title: '返回业务码', required: false, type: Number })
  code: number;

  @ApiProperty({ title: '返回信息', required: false, type: String })
  message: string;

  @ApiProperty({ title: '是否成功', required: false, type: Boolean })
  success: boolean;

  @ApiProperty({ title: '对象记录', required: false, type: [Object] })
  public data: T[];
}

export class Result<T> {
  @ApiProperty({ title: '返回业务码', required: false, type: Number })
  code: number;

  @ApiProperty({ title: '返回信息', required: false, type: String })
  message: string;

  @ApiProperty({ title: '是否成功', required: false, type: Boolean })
  success: boolean;

  @ApiProperty({ title: '对象记录', required: false, type: Object })
  data: T | T[];
}
